package com.star.star.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.star.star.entity.StarIntroductionRead;
import com.star.star.mapper.StarIntroductionReadMapper;
import com.star.star.service.StarIntroductionReadService;
import org.springframework.stereotype.Service;

/**
 * 艺人个人介绍已读 服务实现类
 *
 * @author yangzj
 */
@Service
public class StarIntroductionReadServiceImpl extends ServiceImpl<StarIntroductionReadMapper, StarIntroductionRead> implements StarIntroductionReadService {

    @Override
    public void read(Long starId, Long userId) {
        boolean exists = this.lambdaQuery().eq(StarIntroductionRead::getStarId, starId)
                .eq(StarIntroductionRead::getUserId, userId).exists();
        if(exists){
            return;
        }
        this.save(new StarIntroductionRead().setStarId(starId).setUserId(userId));
    }
}
